﻿using System.Net.Http;
using System.Net.Mime;
using System.Text;

namespace MiniFox.Net.Models
{
    /// <summary>
    /// 
    /// </summary>
    public class WebBinaryRequest : WebMessageRequestBase
    {
        byte[] _data;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        public WebBinaryRequest(byte[] data) : this(data, null)
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="query"></param>
        public WebBinaryRequest(byte[] data, object query) : this(data, query, null)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="query"></param>
        /// <param name="headers"></param>
        public WebBinaryRequest(byte[] data, object query, object headers) : this(HttpMethod.Post, data, query, headers)
        {
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="method"></param>
        /// <param name="data"></param>
        public WebBinaryRequest(HttpMethod method, byte[] data) : this(method, data, null)
        {
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="method"></param>
        /// <param name="query"></param>
        public WebBinaryRequest(HttpMethod method, byte[] data, object query) : this(method, data, query, null)
        {

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="data"></param>
        /// <param name="method"></param>
        /// <param name="query"></param>
        /// <param name="headers"></param>
        public WebBinaryRequest(HttpMethod method, byte[] data, object query, object headers) : base(method, query, headers)
        {
            _data = data;
        }
        /// <summary>
        /// 
        /// </summary>
        public virtual byte[] Data
        {
            get { return this._data; }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        protected internal override HttpContent CreateHttpContent()
        {
            return new ByteArrayContent(this.Data);
        }
    }

}
